import Vue from 'vue'
import Router from 'vue-router'


Vue.use(Router)

//解决ElmentUI导航菜单报错问题
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/',
      name: 'index',
      component: () => import('../views/index.vue'),
    },
    {
      path: '/test',
      name: 'test',
      component: () => import('../views/test.vue')
    },
    {
      path: '/blogs',
      name: 'blogs',
      component: () => import('../views/blogdetail/blogDetail.vue')
    },
    {
      path: '/blog',
      name: 'blog',
      component: () => import('../views/blogdetail/oneBlogDetail.vue')
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/login/login')
    }
  ]
})
